//
//  MemberRightAndInterestsTableViewCell.m
//  quxiangtao
//
//  Created by xbmios on 2018/7/30.
//  Copyright © 2018年 shanhaijin. All rights reserved.
//

#import "MemberRightAndInterestsTableViewCell.h"
#import "MemberWelfareSecondView.h"
#import "MemberWelfareSecondGoodsView.h"

@interface MemberRightAndInterestsTableViewCell ()

@property (strong, nonatomic) MemberWelfareSecondView *listView;
@property (strong, nonatomic) MemberWelfareSecondGoodsView *goodsView;

@end

@implementation MemberRightAndInterestsTableViewCell

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        
        [self.contentView addSubview:self.listView];
        [self.contentView addSubview:self.goodsView];
    }
    
    return self;
}



- (void)reloadWithListArray:(NSArray *)array {
    
    [self.listView reloadArray:array];
    
    [self.listView mas_updateConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(array.count*jisuan(288));
    }];
}

- (void)layoutSubviews {
    
    [super layoutSubviews];
    
    __weak typeof(self) weakSelf = self;
    
    [self.listView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(weakSelf.contentView.mas_left);
        make.right.mas_equalTo(weakSelf.contentView.mas_right);
        make.top.mas_equalTo(weakSelf.contentView.mas_top);
    }];
    [self.goodsView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(weakSelf.contentView.mas_left);
        make.right.mas_equalTo(weakSelf.contentView.mas_right);
        make.bottom.mas_equalTo(weakSelf.contentView.mas_bottom).with.offset(-jisuan(40));
        make.top.mas_equalTo(weakSelf.listView.mas_bottom);
    }];
}

#pragma mark -lazy
- (MemberWelfareSecondView *)listView {
    
    if (!_listView) {
        
        _listView = [[MemberWelfareSecondView alloc] init];
        _listView.backgroundColor = WhiteColor;
    }
    
    return _listView;
}

- (MemberWelfareSecondGoodsView *)goodsView {
    
    if (!_goodsView) {
        
        _goodsView = [[MemberWelfareSecondGoodsView alloc] init];
        _goodsView.backgroundColor = WhiteColor;
    }
    
    return _goodsView;
}

- (void)reloadWithDataArray:(NSArray *)array {
    [self.goodsView reloadVVVDataArray:array];
    
}

//- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
//    [super setSelected:selected animated:animated];
//
//    // Configure the view for the selected state
//}

@end
